package com.hc.tenant.service.impl;

import java.util.List;
import com.hc.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hc.tenant.mapper.DishMapper;
import com.hc.tenant.domain.Dish;
import com.hc.tenant.service.IDishService;

/**
 * 菜肴Service业务层处理
 * 
 * @author yongjianz
 * @date 2021-02-06
 */
@Service
public class DishServiceImpl implements IDishService 
{
    @Autowired
    private DishMapper dishMapper;

    /**
     * 查询菜肴
     * 
     * @param dishId 菜肴ID
     * @return 菜肴
     */
    @Override
    public Dish selectDishById(Long dishId)
    {
        return dishMapper.selectDishById(dishId);
    }

    /**
     * 查询菜肴列表
     * 
     * @param dish 菜肴
     * @return 菜肴
     */
    @Override
    public List<Dish> selectDishList(Dish dish)
    {
        return dishMapper.selectDishList(dish);
    }

    /**
     * 新增菜肴
     * 
     * @param dish 菜肴
     * @return 结果
     */
    @Override
    public int insertDish(Dish dish)
    {
        dish.setCreateTime(DateUtils.getNowDate());
        return dishMapper.insertDish(dish);
    }

    /**
     * 修改菜肴
     * 
     * @param dish 菜肴
     * @return 结果
     */
    @Override
    public int updateDish(Dish dish)
    {
        dish.setUpdateTime(DateUtils.getNowDate());
        return dishMapper.updateDish(dish);
    }

    /**
     * 批量删除菜肴
     * 
     * @param dishIds 需要删除的菜肴ID
     * @return 结果
     */
    @Override
    public int deleteDishByIds(Long[] dishIds)
    {
        return dishMapper.deleteDishByIds(dishIds);
    }

    /**
     * 删除菜肴信息
     * 
     * @param dishId 菜肴ID
     * @return 结果
     */
    @Override
    public int deleteDishById(Long dishId)
    {
        return dishMapper.deleteDishById(dishId);
    }

    @Override
    public List<Dish> selectDishesByDishIds(List<Integer> dishesIds) {
        return dishMapper.selectDishByIds(dishesIds);
    }
}
